﻿using System;

namespace TestUp.Models.ShortEntities
{
    public class ShortUserInfo
    {
        public string UserName { get; set; }
        public string Password { get; set; }
        public string LastName { get; set; }
        public DateTime? RegistrationDate { get; set; }
        public bool? IsLoggedIn { get; set; }
        public int UserId { get; set; }
        public int GroupId { get; set; }
        public int PermissionId { get; set; }
        public string FirstName { get; set; }

        public virtual ShortGroup Group { get; set; }
        public virtual ShortPermission Permission { get; set; }

        public UserInfo ConvertToEntity()
        {
            var userInfo = EntitiesConverter.ToEntity<UserInfo, ShortUserInfo>(this);
            userInfo.Group = Group.ConvertToEntity();
            userInfo.Permission = Permission.ConvertToEntity();

            return userInfo;
        }
    }
}